package routes

import (
	_ "soma-server/docs"
	"soma-server/middleware"

	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
)

// 注册用户路由
func InitSwaggerRoutes(r *gin.RouterGroup, authMiddleware *middleware.JWTMiddleware) gin.IRoutes {
	router := r.Group("/docs")
	// 开启jwt认证中间件
	router.Use(authMiddleware.JWTAuthMiddleware())
	// 开启casbin鉴权中间件
	router.Use(middleware.CasbinMiddleware())
	{
		router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	}
	return r
}
